package com.yndsoft.jc.supplier.base;

import android.os.Bundle;

import com.yndsoft.jc.activity.BaseActivity;
import com.yndsoft.jc.supplier.net.HttpUtil;
import com.yndsoft.jc.supplier.utils.ACache;
import com.yndsoft.jc.supplier.utils.AppSession;
import com.yndsoft.jc.supplier.utils.UiUtils;
import com.yndsoft.jc.supplier.widget.dialog.SupplierDialog;

public abstract class SupplierBaseActivity extends BaseActivity {

    protected AppSession mSession;
    protected HttpUtil mHttpUtil;
    protected ACache mCache;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getContentResId());
        mContext = this;
        UiUtils.initSoftInputHide(this);
        mCache = ACache.get(mContext);
        mSession = AppSession.getInstance(mContext.getApplicationContext());
        mHttpUtil = HttpUtil.getInstance();
        initView();
        initData();
    }

    public abstract int getContentResId();
    public abstract void initView();
    public abstract void initData();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mContext = null;
        mSession = null;
    }

    protected void showHint(String content) {
        new SupplierDialog(mContext).show(false, "提示", content);
    }
}
